<include file="Public/header.html" />
</head>
<style>
.font_color{color: #ff5722;}
.layui-tab-content .layui-form-label{width: 180px;}
.layui-tab-content .layui-input-block{margin-left: 180px;}
.delate_img{width: 26px;position: absolute;height: 26px;line-height: 27px;background: rgba(0,0,0,0.7);text-align: center;top: -10px;
    right: -10px;color: #fff;font-size: 24px;cursor: pointer;border-radius: 100%;}
</style>
<body>
	<div class="x-nav">
        <span class="layui-breadcrumb">
          <a><cite>首页</cite></a>
          <a><cite>系统设置</cite></a>
          <a><cite>提单设置</cite></a>
        </span>
        <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right;height:30px;padding: 0 15px;"  href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon" style="line-height:30px">ဂ</i></a>
   	</div>
	<div class="x-body">
		<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
			<!--<ul class="layui-tab-title">
				<li class="<?php if($flag=='bill'){echo 'layui-this';}?>">
					<a target="_self" href="{:U('Home/Web/System/bill',array('flag'=>'bill'))}">提单设置</a>
				</li>
			</ul>-->
			<div style="padding: 10px;">
				<blockquote class="layui-elem-quote">
			      	操作教程：<a href="https://www.xqzbk.top/jishu/3134.html" target="_blank">https://www.xqzbk.top/jishu/3134.html</a>  <br />
			      	客服微信：qusha2019
			    </blockquote>
				<!--系统设置-->
				<div class="layui-tab-item <?php if($flag=='bill'){echo'layui-show';}?>">
					<form name="bill" id="bill" class="layui-form layui-form-pane" >
						<div class="layui-form-item">
						   	<label class="layui-form-label" style="width: 145px;">接口地址</label>
						    <div class="layui-input-block" style="margin-left: 145px;">
						      	<input type="text" name="url" lay-verify="required" value="{$list['url']}" autocomplete="off" placeholder="请填写提单系统接口地址" class="layui-input">
						    </div>				    
						</div>
						<div class="layui-form-item">
						   	<label class="layui-form-label" style="width: 145px;">apikey</label>
						    <div class="layui-input-block" style="margin-left: 145px;">
						      	<input type="text" name="apikey" lay-verify="required" value="{$list['apikey']}" autocomplete="off" placeholder="请填写提单系统apikey" class="layui-input">
						    </div>				    
						</div>
					  	<div style="height: 10px;"></div>
					</form>	
					<div class="layui-form-item">  
				  		<br/><br/> 
				   	 	<div class="layui-input-block" style="text-align: center;margin-left: 0;">
				      		<button class="layui-btn" type="button" onclick="subform('bill')" style="margin-bottom: 50px;">立即提交</button>
				    	</div>
				  	</div>
				</div>
			</div>
		</div>
	</div>
	<include file="Public/footer.html" />
	<script src="__ROOT__/Public/js/tools.js" charset="utf-8"></script>
	<script>			
		//监听提交
		layui.use(['form','element','layer','upload'], function(){

		});
		
		function subform(flag){
			var tjing = layer.msg('提交中...', {icon: 16,shade: 0.3,time: 60*1000});
	        var form=document.querySelector("#"+flag);
	    	var formData = new FormData(form);
		    formData.append("flag",flag);
			$.ajax({
				type: 'POST',
				url: "{:U('Home/Web/System/do_bill')}",
				 data :formData,
		         dataType:"text",
		         processData : false,         
		         contentType : false,   
				 success: function(data) {
				 	layer.close(tjing);
					if(data == '1') {
              	 		var index = layer.getFrameIndex(window.name);
						layer.msg('提交成功', {icon: 1,offset: '40%',time: 2000,shade: 0.3}, function() {
			       		window.location.href="{:U('Home/Web/System/bill')}&flag="+flag;
						});
					} else if(data == '2') {
						layer.msg('提交失败', {icon: 2,offset: '40%',time: 2000,shade: 0.3})
					}else{
						layer.msg(data, {icon: 2,offset: '40%',time: 2000,shade: 0.3});
					}
				}
			});
		}
	</script>
</body>
</html>